{smcl}
{com}{sf}{ul off}{txt}{.-}
       log:  {res}HICs.smcl
  {txt}log type:  {res}smcl
 {txt}opened on:  {res} 9 Jan 2011, 16:18:26

{com}. do "C:\Users\Piotr\AppData\Local\Temp\STD06000000.tmp"
{txt}
{com}. * ESTIMATING AR(p) BY CLASS
. 
. *** HICs ***
. 
. use HIC_all.dta, clear
{txt}
{com}. 
. *** All incidents
. 
. *MIPT
. sum mAll

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
        mAll {c |}{res}       160      22.125    13.94903          0         66
{txt}
{com}. tab Quarter if mAll==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     2007:2 {c |}{res}          1       33.33       33.33
{txt}     2007:3 {c |}{res}          1       33.33       66.67
{txt}     2007:4 {c |}{res}          1       33.33      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          3      100.00
{txt}
{com}. 
. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima mAll, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-623.6144{col 48}    3{col 57} 1253.229{col 69} 1262.454
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-622.4784{col 48}    4{col 57} 1252.957{col 69} 1265.258
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}   -622.1{col 48}    5{col 57}   1254.2{col 69} 1269.576
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-621.4469{col 48}    6{col 57} 1254.894{col 69} 1273.345
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-620.8047{col 48}    7{col 57} 1255.609{col 69} 1277.136
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-618.9604{col 48}    8{col 57} 1253.921{col 69} 1278.522
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-618.8104{col 48}    9{col 57} 1255.621{col 69} 1283.297
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-618.6674{col 48}   10{col 57} 1257.335{col 69} 1288.087
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(2) according to AIC and AR(1) according to BIC
. * Parsimonity --> estimating AR(1)
. 
. regress mAll L.mAll FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     159
                                                       {help j_robustsingular:F(  5,   152) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.3991
                                                       {txt}Root MSE      = {res} 11.013

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
        mAll {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
        mAll {c |}
         L1. {c |}  {res}  .284487   .1139064     2.50   0.014     .0594428    .5095312
        {txt}FUND {c |}  {res} 11.13598   2.558521     4.35   0.000     6.081123    16.19083
        {txt}POST {c |}  {res}-10.86899   2.658624    -4.09   0.000    -16.12161   -5.616358
        {txt}SEPT {c |}  {res} 12.57077   5.866443     2.14   0.034     .9804761    24.16107
          {txt}Dp {c |}  {res} 9.634302   5.604456     1.72   0.088    -1.438388    20.70699
        {txt}IRAQ {c |}  {res}-16.65639   7.132954    -2.34   0.021    -30.74892   -2.563855
       {txt}_cons {c |}  {res} 12.12268   2.143346     5.66   0.000     7.888085    16.35728
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double mAll_pred
{txt}(option xb assumed; fitted values)
(1 missing value generated)

{com}. line mAll mAll_pred Quarter
{res}{txt}
{com}. drop mAll_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   152) ={res}   90.28
{txt}{col 13}Prob > F ={res}    0.0000
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(1 missing value generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.2960
{txt} Prob > chi2({res}4{txt})            = {res}    0.9901
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if mAll==0
{res}    3
{txt}
{com}. * 3 zero observations - grid search to find c ==> c=0.01
. gen ystar=mAll
{txt}
{com}. replace ystar=0.01 if mAll==0
{txt}(3 real changes made)

{com}. gen lmAll=ln(ystar)
{txt}
{com}. nbreg mAll L.lmAll FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-782.03731{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-781.60145{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-781.60109{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-781.60109{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-655.62811{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-631.74995{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res} -630.3747{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-630.37344{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-630.37344{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-598.51209{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-589.75491{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-587.97093{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-587.96633{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-587.96633{txt}  

Negative binomial regression                      Number of obs   =  {res}      159
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}5{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-587.96633                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}        mAll{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}       lmAll{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .3250031{col 26}{space 2} .0860906{col 37}{space 1}    3.78{col 46}{space 3}0.000{col 55}{space 3} .1562687{col 67}{space 3} .4937376
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .4354018{col 26}{space 2}  .102798{col 37}{space 1}    4.24{col 46}{space 3}0.000{col 55}{space 3} .2339215{col 67}{space 3} .6368821
{col 1}{text}        POST{col 14}{c |}{result}{space 2}-.3792046{col 26}{space 2} .1226432{col 37}{space 1}   -3.09{col 46}{space 3}0.002{col 55}{space 3}-.6195808{col 67}{space 3}-.1388283
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .4331651{col 26}{space 2} .1847288{col 37}{space 1}    2.34{col 46}{space 3}0.019{col 55}{space 3} .0711033{col 67}{space 3} .7952268
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} .3139898{col 26}{space 2} .1516972{col 37}{space 1}    2.07{col 46}{space 3}0.038{col 55}{space 3} .0166687{col 67}{space 3} .6113109
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.5861737{col 26}{space 2} .3396113{col 37}{space 1}   -1.73{col 46}{space 3}0.084{col 55}{space 3}  -1.2518{col 67}{space 3} .0794523
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} 1.928576{col 26}{space 2} .2404699{col 37}{space 1}    8.02{col 46}{space 3}0.000{col 55}{space 3} 1.457263{col 67}{space 3} 2.399888
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-1.550854{col 27}{space 1} .2174652{col 55}{space 3}-1.977078{col 67}{space 3} -1.12463
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .2120668{col 27}{space 1} .0461172{col 55}{space 3} .1384733{col 67}{space 3} .3247727
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[mAll]L.lmAll = 0
{txt} ( 2)  {res}[mAll]FUND = 0
{txt} ( 3)  {res}[mAll]POST = 0
{txt} ( 4)  {res}[mAll]SEPT = 0
{txt} ( 5)  {res}[mAll]Dp = 0
{txt} ( 6)  {res}[mAll]IRAQ = 0

           {txt}chi2(  6) ={res}  293.17
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double mAll_pred
{txt}(option n assumed; predicted number of events)
(1 missing value generated)

{com}. line mAll mAll_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[mAll]SEPT = 0
{txt} ( 2)  {res}[mAll]Dp = 0

{txt}{col 12}chi2(  2) ={res}   62.82
{txt}{col 10}Prob > chi2 =  {res}  0.0000
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (mAll-mAll_pred)/sqrt( mAll_pred*(1+mAll_pred*s2) )
{txt}(1 missing value generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    3.0516
{txt} Prob > chi2({res}4{txt})            = {res}    0.5492
{txt}
{com}. drop nbresidual mAll_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg mAll L.lmAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  159{col 25}-630.3734{col 37}-587.9663{col 48}    7{col 57} 1189.933{col 69} 1211.415
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress mAll L.mAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  159{col 25}-643.9662{col 37}-603.4793{col 48}    6{col 57} 1218.959{col 69} 1237.372
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg mAll L.mAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  159{col 25}-630.3734{col 37} -595.314{col 48}    7{col 57} 1204.628{col 69}  1226.11
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson mAll L.mAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  159{col 25}-1064.277{col 37}-798.5002{col 48}    6{col 57}     1609{col 69} 1627.414
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar lmAll
{txt}
{com}. 
. *All HIC incidents without Israel
. use MIPT_HIC_noIsrael.dta, clear
{txt}
{com}. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima All_noIsrael, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}        .{col 37} -580.339{col 48}    3{col 57} 1166.678{col 69} 1175.847
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}        .{col 37}-573.7436{col 48}    4{col 57} 1155.487{col 69} 1167.712
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}        .{col 37}-572.3228{col 48}    5{col 57} 1154.646{col 69} 1169.927
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}        .{col 37}-571.7444{col 48}    6{col 57} 1155.489{col 69} 1173.826
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}        .{col 37}-571.6271{col 48}    7{col 57} 1157.254{col 69} 1178.648
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}        .{col 37}-567.2046{col 48}    8{col 57} 1150.409{col 69} 1174.859
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}        .{col 37}-567.1877{col 48}    9{col 57} 1152.375{col 69} 1179.882
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}        .{col 37}-566.7358{col 48}   10{col 57} 1153.472{col 69} 1184.034
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. *order AR(2)
. gen ystar=All_noIsrael
{txt}(3 missing values generated)

{com}. replace ystar=0.01 if All_noIsrael==0
{txt}(0 real changes made)

{com}. gen lAll_noIsrael=ln(ystar)
{txt}(3 missing values generated)

{com}. nbreg All_noIsrael L.lAll_noIsrael L2.lAll_noIsrael FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res} -667.3528{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-667.29157{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-667.29156{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-610.86922{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-585.79102{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-584.48453{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-584.48388{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-584.48388{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-551.23393{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-541.38531{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-538.11768{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-538.08653{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-538.08653{txt}  

Negative binomial regression                      Number of obs   =  {res}      155
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}6{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-538.08653                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}All_noIsrael{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}lAll_noIsr~l{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .2608673{col 26}{space 2}  .085483{col 37}{space 1}    3.05{col 46}{space 3}0.002{col 55}{space 3} .0933236{col 67}{space 3} .4284109
{col 1}{text}lAll_noIsr~l{col 14}{c |}
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} .0801014{col 26}{space 2} .0809944{col 37}{space 1}    0.99{col 46}{space 3}0.323{col 55}{space 3}-.0786447{col 67}{space 3} .2388475
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .3213981{col 26}{space 2} .1039203{col 37}{space 1}    3.09{col 46}{space 3}0.002{col 55}{space 3}  .117718{col 67}{space 3} .5250781
{col 1}{text}        POST{col 14}{c |}{result}{space 2}-.3823885{col 26}{space 2} .1398951{col 37}{space 1}   -2.73{col 46}{space 3}0.006{col 55}{space 3}-.6565778{col 67}{space 3}-.1081991
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2}-.3890065{col 26}{space 2} .2528952{col 37}{space 1}   -1.54{col 46}{space 3}0.124{col 55}{space 3} -.884672{col 67}{space 3}  .106659
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} .2432348{col 26}{space 2} .2289704{col 37}{space 1}    1.06{col 46}{space 3}0.288{col 55}{space 3}-.2055389{col 67}{space 3} .6920085
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.1180168{col 26}{space 2} .2485269{col 37}{space 1}   -0.47{col 46}{space 3}0.635{col 55}{space 3}-.6051204{col 67}{space 3} .3690869
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} 1.890679{col 26}{space 2} .2752237{col 37}{space 1}    6.87{col 46}{space 3}0.000{col 55}{space 3}  1.35125{col 67}{space 3} 2.430107
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-1.701633{col 27}{space 1} .1593508{col 55}{space 3}-2.013955{col 67}{space 3}-1.389311
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .1823854{col 27}{space 1} .0290633{col 55}{space 3} .1334598{col 67}{space 3} .2492469
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. *** Predicting Pearson residuals
. predict double All_noIsrael_pred
{txt}(option n assumed; predicted number of events)
(5 missing values generated)

{com}. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (All_noIsrael-All_noIsrael_pred)/sqrt( All_noIsrael_pred*(1+All_noIsrael_pred*s2) )
{txt}(5 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    1.7499
{txt} Prob > chi2({res}4{txt})            = {res}    0.7816
{txt}
{com}. 
. *ITERATE
. use REGRESSION\HIC_all.dta, clear
{txt}
{com}. 
. sum iAll

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
        iAll {c |}{res}       160     26.8875     22.8319          0        171
{txt}
{com}. tab Quarter if mAll==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     2007:2 {c |}{res}          1       33.33       33.33
{txt}     2007:3 {c |}{res}          1       33.33       66.67
{txt}     2007:4 {c |}{res}          1       33.33      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}          3      100.00
{txt}
{com}. 
. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima iAll, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-710.7419{col 48}    3{col 57} 1427.484{col 69} 1436.709
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-694.7709{col 48}    4{col 57} 1397.542{col 69} 1409.843
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-693.6914{col 48}    5{col 57} 1397.383{col 69} 1412.759
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-692.9671{col 48}    6{col 57} 1397.934{col 69} 1416.385
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-690.5165{col 48}    7{col 57} 1395.033{col 69} 1416.559
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-686.3691{col 48}    8{col 57} 1388.738{col 69}  1413.34
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-686.1561{col 48}    9{col 57} 1390.312{col 69} 1417.989
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37} -686.119{col 48}   10{col 57} 1392.238{col 69}  1422.99
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(9) according to AIC and AR(2) according to BIC
. * Estimating AR(2)
. 
. regress iAll L(1/2).iAll FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     158
                                                       {help j_robustsingular:F(  6,   150) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.4048
                                                       {txt}Root MSE      = {res} 18.085

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
        iAll {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
        iAll {c |}
         L1. {c |}  {res} .1234363   .0849957     1.45   0.149    -.0445071    .2913797
         {txt}L2. {c |}  {res} .3097446   .0622049     4.98   0.000     .1868337    .4326556
        {txt}FUND {c |}  {res} 7.136229   3.614353     1.97   0.050    -.0053906    14.27785
        {txt}POST {c |}  {res}-15.09543   6.166963    -2.45   0.016    -27.28076   -2.910093
        {txt}SEPT {c |}  {res}-2.154584   4.539193    -0.47   0.636     -11.1236    6.814431
          {txt}Dp {c |}  {res}-2.145858    2.41507    -0.89   0.376    -6.917809    2.626092
        {txt}IRAQ {c |}  {res}-5.171501   2.560139    -2.02   0.045    -10.23009   -.1129092
       {txt}_cons {c |}  {res} 17.26984   3.724872     4.64   0.000     9.909848    24.62984
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double iAll_pred
{txt}(option xb assumed; fitted values)
(2 missing values generated)

{com}. line iAll iAll_pred Quarter
{res}{txt}
{com}. drop iAll_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   150) ={res}    1.07
{txt}{col 13}Prob > F ={res}    0.3473
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(2 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.4401
{txt} Prob > chi2({res}4{txt})            = {res}    0.9791
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if iAll==0
{res}    1
{txt}
{com}. * 1 zero observations - grid search to find c ==> c=0.13
. gen ystar=iAll
{txt}
{com}. replace ystar=0.13 if iAll==0
{txt}(1 real change made)

{com}. gen liAll=ln(ystar)
{txt}
{com}. nbreg iAll L(1/2).liAll FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-1034.2942{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-1029.1994{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-1029.1889{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-1029.1889{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-682.06849{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-678.11141{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-678.07864{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-678.07864{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-634.52238{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-608.90028{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-606.28043{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-606.19902{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-606.19898{txt}  

Negative binomial regression                      Number of obs   =  {res}      158
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}6{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-606.19898                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}        iAll{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}       liAll{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .2454958{col 26}{space 2} .0775764{col 37}{space 1}    3.16{col 46}{space 3}0.002{col 55}{space 3} .0934488{col 67}{space 3} .3975428
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} .3555408{col 26}{space 2} .0828428{col 37}{space 1}    4.29{col 46}{space 3}0.000{col 55}{space 3} .1931719{col 67}{space 3} .5179097
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .1223346{col 26}{space 2} .1206975{col 37}{space 1}    1.01{col 46}{space 3}0.311{col 55}{space 3}-.1142282{col 67}{space 3} .3588974
{col 1}{text}        POST{col 14}{c |}{result}{space 2}-.3535039{col 26}{space 2} .2654578{col 37}{space 1}   -1.33{col 46}{space 3}0.183{col 55}{space 3}-.8737917{col 67}{space 3} .1667838
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2}-.0339546{col 26}{space 2} .2669088{col 37}{space 1}   -0.13{col 46}{space 3}0.899{col 55}{space 3}-.5570862{col 67}{space 3}  .489177
{col 1}{text}          Dp{col 14}{c |}{result}{space 2}  .097569{col 26}{space 2} .2618386{col 37}{space 1}    0.37{col 46}{space 3}0.709{col 55}{space 3}-.4156251{col 67}{space 3} .6107631
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.5086881{col 26}{space 2} .3330781{col 37}{space 1}   -1.53{col 46}{space 3}0.127{col 55}{space 3}-1.161509{col 67}{space 3}  .144133
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} 1.443168{col 26}{space 2} .3640988{col 37}{space 1}    3.96{col 46}{space 3}0.000{col 55}{space 3} .7295472{col 67}{space 3} 2.156788
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-1.247361{col 27}{space 1} .2188781{col 55}{space 3}-1.676354{col 67}{space 3}-.8183674
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2}  .287262{col 27}{space 1} .0628754{col 55}{space 3} .1870548{col 67}{space 3} .4411513
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[iAll]L.liAll = 0
{txt} ( 2)  {res}[iAll]L2.liAll = 0
{txt} ( 3)  {res}[iAll]FUND = 0
{txt} ( 4)  {res}[iAll]POST = 0
{txt} ( 5)  {res}[iAll]SEPT = 0
{txt} ( 6)  {res}[iAll]Dp = 0
{txt} ( 7)  {res}[iAll]IRAQ = 0

           {txt}chi2(  7) ={res} 1515.66
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double iAll_pred
{txt}(option n assumed; predicted number of events)
(2 missing values generated)

{com}. line iAll iAll_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[iAll]SEPT = 0
{txt} ( 2)  {res}[iAll]Dp = 0

{txt}{col 12}chi2(  2) ={res}    0.21
{txt}{col 10}Prob > chi2 =  {res}  0.8994
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (iAll-iAll_pred)/sqrt( iAll_pred*(1+iAll_pred*s2) )
{txt}(2 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.4827
{txt} Prob > chi2({res}4{txt})            = {res}    0.9752
{txt}
{com}. drop nbresidual iAll_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg iAll L(1/2).liAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-678.0786{col 37} -606.199{col 48}    8{col 57} 1228.398{col 69} 1252.899
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress iAll L(1/2).iAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-718.5031{col 37}  -677.51{col 48}    7{col 57}  1369.02{col 69} 1390.458
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg iAll L(1/2).iAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-678.0786{col 37}-616.0284{col 48}    8{col 57} 1248.057{col 69} 1272.558
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson iAll L(1/2).iAll FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-1772.815{col 37}-1084.291{col 48}    7{col 57} 2182.581{col 69} 2204.019
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar liAll
{txt}
{com}. 
. *** Casualty incidents
. 
. *MIPT
. sum mCasualty

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
   mCasualty {c |}{res}       160     6.71875     5.59444          0         30
{txt}
{com}. tab Quarter if mCasualty==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     1968:1 {c |}{res}          1        6.67        6.67
{txt}     1968:3 {c |}{res}          1        6.67       13.33
{txt}     1969:4 {c |}{res}          1        6.67       20.00
{txt}     1971:1 {c |}{res}          1        6.67       26.67
{txt}     1997:2 {c |}{res}          1        6.67       33.33
{txt}     1999:3 {c |}{res}          1        6.67       40.00
{txt}     1999:4 {c |}{res}          1        6.67       46.67
{txt}     2005:2 {c |}{res}          1        6.67       53.33
{txt}     2005:4 {c |}{res}          1        6.67       60.00
{txt}     2006:1 {c |}{res}          1        6.67       66.67
{txt}     2006:2 {c |}{res}          1        6.67       73.33
{txt}     2006:3 {c |}{res}          1        6.67       80.00
{txt}     2007:2 {c |}{res}          1        6.67       86.67
{txt}     2007:3 {c |}{res}          1        6.67       93.33
{txt}     2007:4 {c |}{res}          1        6.67      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         15      100.00
{txt}
{com}. 
. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima mCasualty, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-450.9551{col 48}    3{col 57} 907.9101{col 69} 917.1356
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-447.1534{col 48}    4{col 57} 902.3068{col 69} 914.6075
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-445.4426{col 48}    5{col 57} 900.8852{col 69}  916.261
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-445.4375{col 48}    6{col 57}  902.875{col 69}  921.326
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-445.2735{col 48}    7{col 57} 904.5469{col 69} 926.0732
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-444.8461{col 48}    8{col 57} 905.6923{col 69} 930.2937
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-444.6474{col 48}    9{col 57} 907.2948{col 69} 934.9714
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-444.2942{col 48}   10{col 57} 908.5883{col 69} 939.3401
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(3) according to AIC and AR(2) according to BIC
. * Estimating AR(2)
. 
. regress mCasualty L(1/2).mCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     158
                                                       {help j_robustsingular:F(  6,   150) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.5756
                                                       {txt}Root MSE      = {res} 3.7225

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
   mCasualty {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
   mCasualty {c |}
         L1. {c |}  {res} .3719109   .0879873     4.23   0.000     .1980563    .5457655
         {txt}L2. {c |}  {res} .1116979    .082879     1.35   0.180    -.0520632    .2754591
        {txt}FUND {c |}  {res} 3.573346   1.013271     3.53   0.001     1.571218    5.575473
        {txt}POST {c |}  {res}-2.991046   .9439217    -3.17   0.002    -4.856146   -1.125946
        {txt}SEPT {c |}  {res} 4.502776   2.646594     1.70   0.091    -.7266429    9.732195
          {txt}Dp {c |}  {res} 7.234255   2.578782     2.81   0.006     2.138825    12.32969
        {txt}IRAQ {c |}  {res}-6.476467   2.729144    -2.37   0.019      -11.869   -1.083938
       {txt}_cons {c |}  {res}  2.11411     .48856     4.33   0.000     1.148761    3.079458
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double mCasualty_pred
{txt}(option xb assumed; fitted values)
(2 missing values generated)

{com}. line mCasualty mCasualty_pred Quarter
{res}{txt}
{com}. drop mCasualty_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   150) ={res}  262.28
{txt}{col 13}Prob > F ={res}    0.0000
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(2 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    2.9082
{txt} Prob > chi2({res}4{txt})            = {res}    0.5733
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if mCasualty==0
{res}   15
{txt}
{com}. * 15 zero observations - grid search to find c ==> c=0.99
. gen ystar=mCasualty
{txt}
{com}. replace ystar=0.99 if mCasualty==0
{txt}(15 real changes made)

{com}. gen lmCasualty=ln(ystar)
{txt}
{com}. nbreg mCasualty L(1/2).lmCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-407.84838{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-407.68647{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-407.68636{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-407.68636{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-471.90554{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-466.26601{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-466.26583{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-466.26583{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-424.75401{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res} -398.5387{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-392.88635{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-392.47333{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-392.47087{txt}  
Iteration 5:{col 16}log pseudolikelihood = {res}-392.47087{txt}  

Negative binomial regression                      Number of obs   =  {res}      158
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}6{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-392.47087                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}   mCasualty{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}  lmCasualty{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .3544369{col 26}{space 2} .0801718{col 37}{space 1}    4.42{col 46}{space 3}0.000{col 55}{space 3}  .197303{col 67}{space 3} .5115708
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} .2545868{col 26}{space 2} .0846351{col 37}{space 1}    3.01{col 46}{space 3}0.003{col 55}{space 3} .0887051{col 67}{space 3} .4204685
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .3374901{col 26}{space 2} .1515087{col 37}{space 1}    2.23{col 46}{space 3}0.026{col 55}{space 3} .0405385{col 67}{space 3} .6344416
{col 1}{text}        POST{col 14}{c |}{result}{space 2}-.2847826{col 26}{space 2} .1143755{col 37}{space 1}   -2.49{col 46}{space 3}0.013{col 55}{space 3}-.5089544{col 67}{space 3}-.0606108
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .3677647{col 26}{space 2} .1961953{col 37}{space 1}    1.87{col 46}{space 3}0.061{col 55}{space 3} -.016771{col 67}{space 3} .7523005
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} .8518206{col 26}{space 2} .1917021{col 37}{space 1}    4.44{col 46}{space 3}0.000{col 55}{space 3} .4760913{col 67}{space 3}  1.22755
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.9306142{col 26}{space 2} .3304346{col 37}{space 1}   -2.82{col 46}{space 3}0.005{col 55}{space 3}-1.578254{col 67}{space 3}-.2829743
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} .6461628{col 26}{space 2} .1398379{col 37}{space 1}    4.62{col 46}{space 3}0.000{col 55}{space 3} .3720856{col 67}{space 3}   .92024
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-2.209885{col 27}{space 1}  .248508{col 55}{space 3}-2.696952{col 67}{space 3}-1.722818
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .1097133{col 27}{space 1} .0272646{col 55}{space 3} .0674107{col 67}{space 3} .1785622
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[mCasualty]L.lmCasualty = 0
{txt} ( 2)  {res}[mCasualty]L2.lmCasualty = 0
{txt} ( 3)  {res}[mCasualty]FUND = 0
{txt} ( 4)  {res}[mCasualty]POST = 0
{txt} ( 5)  {res}[mCasualty]SEPT = 0
{txt} ( 6)  {res}[mCasualty]Dp = 0
{txt} ( 7)  {res}[mCasualty]IRAQ = 0

           {txt}chi2(  7) ={res}  559.66
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double mCasualty_pred
{txt}(option n assumed; predicted number of events)
(2 missing values generated)

{com}. line mCasualty mCasualty_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[mCasualty]SEPT = 0
{txt} ( 2)  {res}[mCasualty]Dp = 0

{txt}{col 12}chi2(  2) ={res}  149.88
{txt}{col 10}Prob > chi2 =  {res}  0.0000
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (mCasualty-mCasualty_pred)/sqrt( mCasualty_pred*(1+mCasualty_pred*s2) )
{txt}(2 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    2.4699
{txt} Prob > chi2({res}4{txt})            = {res}    0.6500
{txt}
{com}. drop nbresidual mCasualty_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg mCasualty L(1/2).lmCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-466.2658{col 37}-392.4709{col 48}    8{col 57} 800.9417{col 69} 825.4425
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress mCasualty L(1/2).mCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-495.4695{col 37}-427.7613{col 48}    7{col 57} 869.5227{col 69} 890.9609
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg mCasualty L(1/2).mCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25}-466.2658{col 37}-405.3699{col 48}    8{col 57} 826.7398{col 69} 851.2406
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson mCasualty L(1/2).mCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  158{col 25} -622.819{col 37}-428.3402{col 48}    7{col 57} 870.6804{col 69} 892.1185
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar lmCasualty
{txt}
{com}. 
. *ITERATE
. sum iCasualty

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
   iCasualty {c |}{res}       160     6.73125    6.008089          0         27
{txt}
{com}. tab Quarter if iCasualty==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     1969:4 {c |}{res}          1        8.33        8.33
{txt}     1991:2 {c |}{res}          1        8.33       16.67
{txt}     1997:2 {c |}{res}          1        8.33       25.00
{txt}     1998:2 {c |}{res}          1        8.33       33.33
{txt}     1999:4 {c |}{res}          1        8.33       41.67
{txt}     2000:1 {c |}{res}          1        8.33       50.00
{txt}     2001:1 {c |}{res}          1        8.33       58.33
{txt}     2002:2 {c |}{res}          1        8.33       66.67
{txt}     2005:2 {c |}{res}          1        8.33       75.00
{txt}     2005:4 {c |}{res}          1        8.33       83.33
{txt}     2006:3 {c |}{res}          1        8.33       91.67
{txt}     2007:3 {c |}{res}          1        8.33      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         12      100.00
{txt}
{com}. 
. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima iCasualty, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-473.6837{col 48}    3{col 57} 953.3675{col 69}  962.593
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-465.9502{col 48}    4{col 57} 939.9004{col 69} 952.2011
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-461.8691{col 48}    5{col 57} 933.7382{col 69}  949.114
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-458.6974{col 48}    6{col 57} 929.3949{col 69} 947.8459
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-457.9265{col 48}    7{col 57} 929.8531{col 69} 951.3793
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-456.7268{col 48}    8{col 57} 929.4537{col 69} 954.0551
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-456.7173{col 48}    9{col 57} 931.4346{col 69} 959.1112
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-456.5264{col 48}   10{col 57} 933.0529{col 69} 963.8046
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(4) according to AIC and AR(4) according to BIC
. * Estimating AR(4)
. 
. regress iCasualty L(1/4).iCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     156
                                                       {help j_robustsingular:F(  8,   146) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.5071
                                                       {txt}Root MSE      = {res} 4.3617

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
   iCasualty {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
   iCasualty {c |}
         L1. {c |}  {res} .2944106   .0864988     3.40   0.001      .123459    .4653622
         {txt}L2. {c |}  {res} .1489183   .1004197     1.48   0.140    -.0495457    .3473823
         {txt}L3. {c |}  {res} .1324672   .0969445     1.37   0.174    -.0591286     .324063
         {txt}L4. {c |}  {res} .1752944    .114245     1.53   0.127    -.0504933     .401082
        {txt}FUND {c |}  {res} .2168333   1.206689     0.18   0.858    -2.168002    2.601668
        {txt}POST {c |}  {res}-1.435944   1.314039    -1.09   0.276     -4.03294    1.161051
        {txt}SEPT {c |}  {res}-.0128796   .9953741    -0.01   0.990    -1.980083    1.954324
          {txt}Dp {c |}  {res}  4.26095   .7771726     5.48   0.000     2.724989    5.796912
        {txt}IRAQ {c |}  {res}-.7504002   .8578823    -0.87   0.383    -2.445872    .9450718
       {txt}_cons {c |}  {res} 2.193574   .8460231     2.59   0.010       .52154    3.865608
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double iCasualty_pred
{txt}(option xb assumed; fitted values)
(4 missing values generated)

{com}. line iCasualty iCasualty_pred Quarter
{res}{txt}
{com}. drop iCasualty_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   146) ={res}   35.53
{txt}{col 13}Prob > F ={res}    0.0000
{txt}
{com}. 
. * Ljung-Box statistic Q(5) - testing H0: white noise(in residuals)--> the first 5 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(4 missing values generated)

{com}. wntestq resid, lags(5)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    1.4594
{txt} Prob > chi2({res}5{txt})            = {res}    0.9177
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if iCasualty==0
{res}   12
{txt}
{com}. * 12 zero observations - grid search to find c ==> c=0.06
. gen ystar=iCasualty
{txt}
{com}. replace ystar=0.06 if iCasualty==0
{txt}(12 real changes made)

{com}. gen liCasualty=ln(ystar)
{txt}
{com}. nbreg iCasualty L(1/4).liCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-452.79625{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-452.56646{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-452.56608{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-452.56608{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-467.24342{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-464.24602{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-464.24566{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-464.24566{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-429.11864{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-410.75723{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-408.09703{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-408.05746{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-408.05744{txt}  

Negative binomial regression                      Number of obs   =  {res}      156
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}8{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-408.05744                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}   iCasualty{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}  liCasualty{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .1683901{col 26}{space 2} .0512321{col 37}{space 1}    3.29{col 46}{space 3}0.001{col 55}{space 3}  .067977{col 67}{space 3} .2688033
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} .1883092{col 26}{space 2} .0543989{col 37}{space 1}    3.46{col 46}{space 3}0.001{col 55}{space 3} .0816893{col 67}{space 3} .2949291
{col 1}{text}         L3.{col 14}{c |}{result}{space 2} .0907163{col 26}{space 2} .0711631{col 37}{space 1}    1.27{col 46}{space 3}0.202{col 55}{space 3}-.0487607{col 67}{space 3} .2301934
{col 1}{text}         L4.{col 14}{c |}{result}{space 2} .1237846{col 26}{space 2} .0706201{col 37}{space 1}    1.75{col 46}{space 3}0.080{col 55}{space 3}-.0146282{col 67}{space 3} .2621974
{col 1}{text}        FUND{col 14}{c |}{result}{space 2}  .028764{col 26}{space 2} .1310223{col 37}{space 1}    0.22{col 46}{space 3}0.826{col 55}{space 3}-.2280351{col 67}{space 3}  .285563
{col 1}{text}        POST{col 14}{c |}{result}{space 2}-.2040198{col 26}{space 2} .1932792{col 37}{space 1}   -1.06{col 46}{space 3}0.291{col 55}{space 3}-.5828401{col 67}{space 3} .1748004
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .1309527{col 26}{space 2} .3103668{col 37}{space 1}    0.42{col 46}{space 3}0.673{col 55}{space 3} -.477355{col 67}{space 3} .7392604
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} 1.251745{col 26}{space 2} .3274233{col 37}{space 1}    3.82{col 46}{space 3}0.000{col 55}{space 3} .6100069{col 67}{space 3} 1.893483
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.5197589{col 26}{space 2} .3326615{col 37}{space 1}   -1.56{col 46}{space 3}0.118{col 55}{space 3}-1.171763{col 67}{space 3} .1322456
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} 1.028308{col 26}{space 2} .1498691{col 37}{space 1}    6.86{col 46}{space 3}0.000{col 55}{space 3} .7345698{col 67}{space 3} 1.322046
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-1.432783{col 27}{space 1} .2175164{col 55}{space 3}-1.859107{col 67}{space 3}-1.006459
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .2386439{col 27}{space 1}  .051909{col 55}{space 3} .1558117{col 67}{space 3} .3655111
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[iCasualty]L.liCasualty = 0
{txt} ( 2)  {res}[iCasualty]L2.liCasualty = 0
{txt} ( 3)  {res}[iCasualty]L3.liCasualty = 0
{txt} ( 4)  {res}[iCasualty]L4.liCasualty = 0
{txt} ( 5)  {res}[iCasualty]FUND = 0
{txt} ( 6)  {res}[iCasualty]POST = 0
{txt} ( 7)  {res}[iCasualty]SEPT = 0
{txt} ( 8)  {res}[iCasualty]Dp = 0
{txt} ( 9)  {res}[iCasualty]IRAQ = 0

           {txt}chi2(  9) ={res}  215.72
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double iCasualty_pred
{txt}(option n assumed; predicted number of events)
(4 missing values generated)

{com}. line iCasualty iCasualty_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[iCasualty]SEPT = 0
{txt} ( 2)  {res}[iCasualty]Dp = 0

{txt}{col 12}chi2(  2) ={res}   40.40
{txt}{col 10}Prob > chi2 =  {res}  0.0000
{txt}
{com}. * Ljung-Box statistic Q(5) - testing H0: white noise(in residuals)--> the first 5 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (iCasualty-iCasualty_pred)/sqrt( iCasualty_pred*(1+iCasualty_pred*s2) )
{txt}(4 missing values generated)

{com}. wntestq nbresidual, lags(5)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    2.5231
{txt} Prob > chi2({res}5{txt})            = {res}    0.7730
{txt}
{com}. drop nbresidual iCasualty_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg iCasualty L(1/4).liCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  156{col 25}-464.2457{col 37}-408.0574{col 48}   10{col 57} 836.1149{col 69} 866.6134
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress iCasualty L(1/4).iCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  156{col 25}-501.1309{col 37}-445.9519{col 48}    9{col 57} 909.9039{col 69} 937.3526
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg iCasualty L(1/4).iCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  156{col 25}-464.2457{col 37}-411.7744{col 48}   10{col 57} 843.5487{col 69} 874.0473
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson iCasualty L(1/4).iCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  156{col 25}-661.7391{col 37}-460.7508{col 48}    9{col 57} 939.5015{col 69} 966.9502
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar liCasualty
{txt}
{com}. 
. *** US target incidents
. 
. *MIPT
. sum mUS_Target

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
  mUS_Target {c |}{res}       160     4.01875    3.981833          0         22
{txt}
{com}. tab Quarter if mUS_Target==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     1968:3 {c |}{res}          1        4.55        4.55
{txt}     1991:2 {c |}{res}          1        4.55        9.09
{txt}     1991:3 {c |}{res}          1        4.55       13.64
{txt}     1992:3 {c |}{res}          1        4.55       18.18
{txt}     1994:2 {c |}{res}          1        4.55       22.73
{txt}     1995:1 {c |}{res}          1        4.55       27.27
{txt}     1997:2 {c |}{res}          1        4.55       31.82
{txt}     1997:4 {c |}{res}          1        4.55       36.36
{txt}     1998:3 {c |}{res}          1        4.55       40.91
{txt}     1999:3 {c |}{res}          1        4.55       45.45
{txt}     2001:1 {c |}{res}          1        4.55       50.00
{txt}     2002:2 {c |}{res}          1        4.55       54.55
{txt}     2003:4 {c |}{res}          1        4.55       59.09
{txt}     2004:3 {c |}{res}          1        4.55       63.64
{txt}     2005:2 {c |}{res}          1        4.55       68.18
{txt}     2005:3 {c |}{res}          1        4.55       72.73
{txt}     2006:1 {c |}{res}          1        4.55       77.27
{txt}     2006:3 {c |}{res}          1        4.55       81.82
{txt}     2006:4 {c |}{res}          1        4.55       86.36
{txt}     2007:2 {c |}{res}          1        4.55       90.91
{txt}     2007:3 {c |}{res}          1        4.55       95.45
{txt}     2007:4 {c |}{res}          1        4.55      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         22      100.00
{txt}
{com}. 
. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima mUS_Target, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-436.2028{col 48}    3{col 57} 878.4057{col 69} 887.6312
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-431.8546{col 48}    4{col 57} 871.7092{col 69} 884.0099
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-428.5347{col 48}    5{col 57} 867.0693{col 69} 882.4452
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-427.7109{col 48}    6{col 57} 867.4217{col 69} 885.8728
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-427.4777{col 48}    7{col 57} 868.9553{col 69} 890.4816
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-427.4483{col 48}    8{col 57} 870.8966{col 69}  895.498
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-427.2543{col 48}    9{col 57} 872.5086{col 69} 900.1851
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-427.2089{col 48}   10{col 57} 874.4177{col 69} 905.1695
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(3) according to AIC and AR(3) according to BIC
. * Estimating AR(3)
. 
. regress mUS_Target L(1/3).mUS_Target FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     157
                                                       {help j_robustsingular:F(  7,   148) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.2899
                                                       {txt}Root MSE      = {res} 3.4607

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
  mUS_Target {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
  mUS_Target {c |}
         L1. {c |}  {res} .1273415   .1269986     1.00   0.318    -.1236234    .3783063
         {txt}L2. {c |}  {res} .0748526   .0938241     0.80   0.426    -.1105554    .2602605
         {txt}L3. {c |}  {res} .0979584   .0923192     1.06   0.290    -.0844756    .2803923
        {txt}FUND {c |}  {res} 2.212402   .9385435     2.36   0.020     .3577253    4.067079
        {txt}POST {c |}  {res}-3.133084   1.045621    -3.00   0.003     -5.19936   -1.066807
        {txt}SEPT {c |}  {res} .5915381   1.115194     0.53   0.597    -1.612223    2.795299
          {txt}Dp {c |}  {res} 2.409376   1.111642     2.17   0.032     .2126361    4.606117
        {txt}IRAQ {c |}  {res}-1.570237   1.137337    -1.38   0.169    -3.817754    .6772803
       {txt}_cons {c |}  {res} 2.596509   .7327587     3.54   0.001     1.148488     4.04453
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double mUS_Target_pred
{txt}(option xb assumed; fitted values)
(3 missing values generated)

{com}. line mUS_Target mUS_Target_pred Quarter
{res}{txt}
{com}. drop mUS_Target_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   148) ={res}   20.71
{txt}{col 13}Prob > F ={res}    0.0000
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(3 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.3118
{txt} Prob > chi2({res}4{txt})            = {res}    0.9890
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if mUS_Target==0
{res}   22
{txt}
{com}. * 22 zero observations - grid search to find c ==> c=0.23
. gen ystar=mUS_Target
{txt}
{com}. replace ystar=0.23 if mUS_Target==0
{txt}(22 real changes made)

{com}. gen lmUS_Target=ln(ystar)
{txt}
{com}. nbreg mUS_Target L(1/3).lmUS_Target FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-399.83488{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-399.77962{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-399.77957{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-399.77957{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-395.25141{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-391.16233{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-391.15706{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-391.15706{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-367.78916{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-361.40996{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-360.44672{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-360.43924{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-360.43924{txt}  

Negative binomial regression                      Number of obs   =  {res}      157
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}7{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-360.43924                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}  mUS_Target{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text} lmUS_Target{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2} .0683651{col 26}{space 2} .0805686{col 37}{space 1}    0.85{col 46}{space 3}0.396{col 55}{space 3}-.0895464{col 67}{space 3} .2262767
{col 1}{text}         L2.{col 14}{c |}{result}{space 2}  .046953{col 26}{space 2} .0714429{col 37}{space 1}    0.66{col 46}{space 3}0.511{col 55}{space 3}-.0930726{col 67}{space 3} .1869786
{col 1}{text}         L3.{col 14}{c |}{result}{space 2} .1044178{col 26}{space 2} .0866829{col 37}{space 1}    1.20{col 46}{space 3}0.228{col 55}{space 3}-.0654776{col 67}{space 3} .2743131
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .4757551{col 26}{space 2} .1711335{col 37}{space 1}    2.78{col 46}{space 3}0.005{col 55}{space 3} .1403397{col 67}{space 3} .8111706
{col 1}{text}        POST{col 14}{c |}{result}{space 2} -.749194{col 26}{space 2} .2467366{col 37}{space 1}   -3.04{col 46}{space 3}0.002{col 55}{space 3}-1.232789{col 67}{space 3}-.2655992
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .2513127{col 26}{space 2} .3864365{col 37}{space 1}    0.65{col 46}{space 3}0.515{col 55}{space 3}-.5060888{col 67}{space 3} 1.008714
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} .5546259{col 26}{space 2} .4041738{col 37}{space 1}    1.37{col 46}{space 3}0.170{col 55}{space 3}-.2375401{col 67}{space 3} 1.346792
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.8844721{col 26}{space 2} .4849332{col 37}{space 1}   -1.82{col 46}{space 3}0.068{col 55}{space 3}-1.834924{col 67}{space 3} .0659796
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} 1.073567{col 26}{space 2} .1613499{col 37}{space 1}    6.65{col 46}{space 3}0.000{col 55}{space 3}  .757327{col 67}{space 3} 1.389807
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-1.117747{col 27}{space 1} .2013705{col 55}{space 3}-1.512426{col 67}{space 3}-.7230683
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .3270157{col 27}{space 1} .0658513{col 55}{space 3} .2203747{col 67}{space 3}  .485261
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[mUS_Target]L.lmUS_Target = 0
{txt} ( 2)  {res}[mUS_Target]L2.lmUS_Target = 0
{txt} ( 3)  {res}[mUS_Target]L3.lmUS_Target = 0
{txt} ( 4)  {res}[mUS_Target]FUND = 0
{txt} ( 5)  {res}[mUS_Target]POST = 0
{txt} ( 6)  {res}[mUS_Target]SEPT = 0
{txt} ( 7)  {res}[mUS_Target]Dp = 0
{txt} ( 8)  {res}[mUS_Target]IRAQ = 0

           {txt}chi2(  8) ={res}   68.04
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double mUS_Target_pred
{txt}(option n assumed; predicted number of events)
(3 missing values generated)

{com}. line mUS_Target mUS_Target_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[mUS_Target]SEPT = 0
{txt} ( 2)  {res}[mUS_Target]Dp = 0

{txt}{col 12}chi2(  2) ={res}   16.64
{txt}{col 10}Prob > chi2 =  {res}  0.0002
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (mUS_Target-mUS_Target_pred)/sqrt( mUS_Target_pred*(1+mUS_Target_pred*s2) )
{txt}(3 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    1.5888
{txt} Prob > chi2({res}4{txt})            = {res}    0.8108
{txt}
{com}. drop nbresidual mUS_Target_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg mUS_Target L(1/3).lmUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}-391.1571{col 37}-360.4392{col 48}    9{col 57} 738.8785{col 69} 766.3847
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress mUS_Target L(1/3).mUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}-439.9272{col 37}-413.0483{col 48}    8{col 57} 842.0966{col 69} 866.5466
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg mUS_Target L(1/3).mUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}-391.1571{col 37}-360.6467{col 48}    9{col 57} 739.2934{col 69} 766.7996
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson mUS_Target L(1/3).mUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25} -486.547{col 37}-399.7135{col 48}    8{col 57}  815.427{col 69}  839.877
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar lmUS_Target
{txt}
{com}. 
. *ITERATE
. sum iUS_Target

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
  iUS_Target {c |}{res}       160       5.925    6.011049          0         35
{txt}
{com}. tab Quarter if iCasualty==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     1969:4 {c |}{res}          1        8.33        8.33
{txt}     1991:2 {c |}{res}          1        8.33       16.67
{txt}     1997:2 {c |}{res}          1        8.33       25.00
{txt}     1998:2 {c |}{res}          1        8.33       33.33
{txt}     1999:4 {c |}{res}          1        8.33       41.67
{txt}     2000:1 {c |}{res}          1        8.33       50.00
{txt}     2001:1 {c |}{res}          1        8.33       58.33
{txt}     2002:2 {c |}{res}          1        8.33       66.67
{txt}     2005:2 {c |}{res}          1        8.33       75.00
{txt}     2005:4 {c |}{res}          1        8.33       83.33
{txt}     2006:3 {c |}{res}          1        8.33       91.67
{txt}     2007:3 {c |}{res}          1        8.33      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         12      100.00
{txt}
{com}. 
. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima iUS_Target, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-507.9863{col 48}    3{col 57} 1021.973{col 69} 1031.198
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-497.4054{col 48}    4{col 57} 1002.811{col 69} 1015.112
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-491.9273{col 48}    5{col 57} 993.8545{col 69}  1009.23
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-491.8537{col 48}    6{col 57} 995.7073{col 69} 1014.158
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-488.5078{col 48}    7{col 57} 991.0157{col 69} 1012.542
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-488.5076{col 48}    8{col 57} 993.0151{col 69} 1017.617
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-488.2655{col 48}    9{col 57} 994.5309{col 69} 1022.207
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-488.0754{col 48}   10{col 57} 996.1509{col 69} 1026.903
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(5) according to AIC and AR(3) according to BIC
. * Estimating AR(3)
. 
. regress iUS_Target L(1/3).iUS_Target FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     157
                                                       {help j_robustsingular:F(  7,   148) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.2943
                                                       {txt}Root MSE      = {res} 5.2224

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
  iUS_Target {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
  iUS_Target {c |}
         L1. {c |}  {res} -.013894   .1104112    -0.13   0.900    -.2320801    .2042922
         {txt}L2. {c |}  {res} .2095281   .1010157     2.07   0.040     .0099088    .4091474
         {txt}L3. {c |}  {res} .1694911   .1235393     1.37   0.172    -.0746377    .4136199
        {txt}FUND {c |}  {res} .2261685   1.323278     0.17   0.865     -2.38879    2.841127
        {txt}POST {c |}  {res}-3.891879   1.485627    -2.62   0.010     -6.82766   -.9560977
        {txt}SEPT {c |}  {res} 1.727112   1.155864     1.49   0.137    -.5570158     4.01124
          {txt}Dp {c |}  {res} .5969784   1.289804     0.46   0.644    -1.951832    3.145789
        {txt}IRAQ {c |}  {res}-2.312805   1.202823    -1.92   0.056    -4.689731    .0641204
       {txt}_cons {c |}  {res} 5.169076   1.818906     2.84   0.005     1.574696    8.763456
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double iUS_Target_pred
{txt}(option xb assumed; fitted values)
(3 missing values generated)

{com}. line iUS_Target iUS_Target_pred Quarter
{res}{txt}
{com}. drop iUS_Target_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   148) ={res}    5.48
{txt}{col 13}Prob > F ={res}    0.0050
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(3 missing values generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    1.6405
{txt} Prob > chi2({res}4{txt})            = {res}    0.8015
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if iUS_Target==0
{res}   16
{txt}
{com}. * 16 zero observations - grid search to find c ==> c=0.01
. gen ystar=iUS_Target
{txt}
{com}. replace ystar=0.01 if iUS_Target==0
{txt}(16 real changes made)

{com}. gen liUS_Target=ln(ystar)
{txt}
{com}. nbreg iUS_Target L(1/3).liUS_Target FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-508.64758{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-508.49456{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-508.49443{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-508.49443{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-449.79019{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-448.07274{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-448.07268{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-448.07268{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-422.38637{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-416.22885{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-412.04377{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-411.97021{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-411.97019{txt}  

Negative binomial regression                      Number of obs   =  {res}      157
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}7{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-411.97019                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text}  iUS_Target{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text} liUS_Target{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2}-.0288356{col 26}{space 2} .0408992{col 37}{space 1}   -0.71{col 46}{space 3}0.481{col 55}{space 3}-.1089967{col 67}{space 3} .0513254
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} .0666967{col 26}{space 2} .0473595{col 37}{space 1}    1.41{col 46}{space 3}0.159{col 55}{space 3}-.0261262{col 67}{space 3} .1595196
{col 1}{text}         L3.{col 14}{c |}{result}{space 2} .0464912{col 26}{space 2} .0384122{col 37}{space 1}    1.21{col 46}{space 3}0.226{col 55}{space 3}-.0287953{col 67}{space 3} .1217777
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} .0496346{col 26}{space 2} .1573693{col 37}{space 1}    0.32{col 46}{space 3}0.752{col 55}{space 3}-.2588036{col 67}{space 3} .3580728
{col 1}{text}        POST{col 14}{c |}{result}{space 2}-1.085355{col 26}{space 2} .2374553{col 37}{space 1}   -4.57{col 46}{space 3}0.000{col 55}{space 3}-1.550758{col 67}{space 3}-.6199507
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .5610159{col 26}{space 2} .2819124{col 37}{space 1}    1.99{col 46}{space 3}0.047{col 55}{space 3} .0084777{col 67}{space 3} 1.113554
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} .3657186{col 26}{space 2} .3655999{col 37}{space 1}    1.00{col 46}{space 3}0.317{col 55}{space 3}-.3508441{col 67}{space 3} 1.082281
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.9261528{col 26}{space 2} .3347333{col 37}{space 1}   -2.77{col 46}{space 3}0.006{col 55}{space 3}-1.582218{col 67}{space 3}-.2700876
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} 1.935105{col 26}{space 2} .1654507{col 37}{space 1}   11.70{col 46}{space 3}0.000{col 55}{space 3} 1.610828{col 67}{space 3} 2.259383
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-.8936467{col 27}{space 1} .1727389{col 55}{space 3}-1.232209{col 67}{space 3}-.5550847
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .4091609{col 27}{space 1}  .070678{col 55}{space 3} .2916477{col 67}{space 3} .5740236
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[iUS_Target]L.liUS_Target = 0
{txt} ( 2)  {res}[iUS_Target]L2.liUS_Target = 0
{txt} ( 3)  {res}[iUS_Target]L3.liUS_Target = 0
{txt} ( 4)  {res}[iUS_Target]FUND = 0
{txt} ( 5)  {res}[iUS_Target]POST = 0
{txt} ( 6)  {res}[iUS_Target]SEPT = 0
{txt} ( 7)  {res}[iUS_Target]Dp = 0
{txt} ( 8)  {res}[iUS_Target]IRAQ = 0

           {txt}chi2(  8) ={res}   83.91
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double iUS_Target_pred
{txt}(option n assumed; predicted number of events)
(3 missing values generated)

{com}. line iUS_Target iUS_Target_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[iUS_Target]SEPT = 0
{txt} ( 2)  {res}[iUS_Target]Dp = 0

{txt}{col 12}chi2(  2) ={res}   11.06
{txt}{col 10}Prob > chi2 =  {res}  0.0040
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (iUS_Target-iUS_Target_pred)/sqrt( iUS_Target_pred*(1+iUS_Target_pred*s2) )
{txt}(3 missing values generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.0484
{txt} Prob > chi2({res}4{txt})            = {res}    0.9997
{txt}
{com}. drop nbresidual iUS_Target_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg iUS_Target L(1/3).liUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}-448.0727{col 37}-411.9702{col 48}    9{col 57} 841.9404{col 69} 869.4466
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress iUS_Target L(1/3).iUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}-505.0152{col 37}-477.6537{col 48}    8{col 57} 971.3074{col 69} 995.7574
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg iUS_Target L(1/3).iUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}-448.0727{col 37}-409.5172{col 48}    9{col 57} 837.0344{col 69} 864.5407
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson iUS_Target L(1/3).iUS_Target FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  157{col 25}-653.4529{col 37}-503.1799{col 48}    8{col 57}  1022.36{col 69}  1046.81
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar liUS_Target
{txt}
{com}. 
. *** Casualty incidents with a U.S. Target                                                                                               
. 
. *MIPT
. sum mUSCasualty

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
 mUSCasualty {c |}{res}       160        .725    1.181354          0          6
{txt}
{com}. tab Quarter if mUSCasualty==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     1968:1 {c |}{res}          1        1.06        1.06
{txt}     1968:2 {c |}{res}          1        1.06        2.13
{txt}     1968:3 {c |}{res}          1        1.06        3.19
{txt}     1968:4 {c |}{res}          1        1.06        4.26
{txt}     1969:1 {c |}{res}          1        1.06        5.32
{txt}     1969:2 {c |}{res}          1        1.06        6.38
{txt}     1969:4 {c |}{res}          1        1.06        7.45
{txt}     1970:1 {c |}{res}          1        1.06        8.51
{txt}     1970:2 {c |}{res}          1        1.06        9.57
{txt}     1970:3 {c |}{res}          1        1.06       10.64
{txt}     1970:4 {c |}{res}          1        1.06       11.70
{txt}     1971:1 {c |}{res}          1        1.06       12.77
{txt}     1971:3 {c |}{res}          1        1.06       13.83
{txt}     1971:4 {c |}{res}          1        1.06       14.89
{txt}     1972:1 {c |}{res}          1        1.06       15.96
{txt}     1972:3 {c |}{res}          1        1.06       17.02
{txt}     1973:1 {c |}{res}          1        1.06       18.09
{txt}     1973:2 {c |}{res}          1        1.06       19.15
{txt}     1973:4 {c |}{res}          1        1.06       20.21
{txt}     1974:1 {c |}{res}          1        1.06       21.28
{txt}     1974:3 {c |}{res}          1        1.06       22.34
{txt}     1975:1 {c |}{res}          1        1.06       23.40
{txt}     1975:2 {c |}{res}          1        1.06       24.47
{txt}     1975:3 {c |}{res}          1        1.06       25.53
{txt}     1976:1 {c |}{res}          1        1.06       26.60
{txt}     1977:2 {c |}{res}          1        1.06       27.66
{txt}     1977:3 {c |}{res}          1        1.06       28.72
{txt}     1977:4 {c |}{res}          1        1.06       29.79
{txt}     1978:1 {c |}{res}          1        1.06       30.85
{txt}     1978:3 {c |}{res}          1        1.06       31.91
{txt}     1978:4 {c |}{res}          1        1.06       32.98
{txt}     1979:2 {c |}{res}          1        1.06       34.04
{txt}     1980:1 {c |}{res}          1        1.06       35.11
{txt}     1980:2 {c |}{res}          1        1.06       36.17
{txt}     1981:2 {c |}{res}          1        1.06       37.23
{txt}     1983:3 {c |}{res}          1        1.06       38.30
{txt}     1984:3 {c |}{res}          1        1.06       39.36
{txt}     1984:4 {c |}{res}          1        1.06       40.43
{txt}     1985:2 {c |}{res}          1        1.06       41.49
{txt}     1986:1 {c |}{res}          1        1.06       42.55
{txt}     1986:4 {c |}{res}          1        1.06       43.62
{txt}     1987:1 {c |}{res}          1        1.06       44.68
{txt}     1987:3 {c |}{res}          1        1.06       45.74
{txt}     1988:3 {c |}{res}          1        1.06       46.81
{txt}     1989:1 {c |}{res}          1        1.06       47.87
{txt}     1989:2 {c |}{res}          1        1.06       48.94
{txt}     1989:4 {c |}{res}          1        1.06       50.00
{txt}     1990:1 {c |}{res}          1        1.06       51.06
{txt}     1990:2 {c |}{res}          1        1.06       52.13
{txt}     1991:1 {c |}{res}          1        1.06       53.19
{txt}     1991:2 {c |}{res}          1        1.06       54.26
{txt}     1991:3 {c |}{res}          1        1.06       55.32
{txt}     1991:4 {c |}{res}          1        1.06       56.38
{txt}     1992:1 {c |}{res}          1        1.06       57.45
{txt}     1992:2 {c |}{res}          1        1.06       58.51
{txt}     1992:3 {c |}{res}          1        1.06       59.57
{txt}     1992:4 {c |}{res}          1        1.06       60.64
{txt}     1993:3 {c |}{res}          1        1.06       61.70
{txt}     1993:4 {c |}{res}          1        1.06       62.77
{txt}     1994:2 {c |}{res}          1        1.06       63.83
{txt}     1995:1 {c |}{res}          1        1.06       64.89
{txt}     1996:4 {c |}{res}          1        1.06       65.96
{txt}     1997:2 {c |}{res}          1        1.06       67.02
{txt}     1997:4 {c |}{res}          1        1.06       68.09
{txt}     1998:1 {c |}{res}          1        1.06       69.15
{txt}     1998:2 {c |}{res}          1        1.06       70.21
{txt}     1998:3 {c |}{res}          1        1.06       71.28
{txt}     1998:4 {c |}{res}          1        1.06       72.34
{txt}     1999:1 {c |}{res}          1        1.06       73.40
{txt}     1999:2 {c |}{res}          1        1.06       74.47
{txt}     1999:3 {c |}{res}          1        1.06       75.53
{txt}     1999:4 {c |}{res}          1        1.06       76.60
{txt}     2000:1 {c |}{res}          1        1.06       77.66
{txt}     2000:3 {c |}{res}          1        1.06       78.72
{txt}     2000:4 {c |}{res}          1        1.06       79.79
{txt}     2001:1 {c |}{res}          1        1.06       80.85
{txt}     2001:2 {c |}{res}          1        1.06       81.91
{txt}     2001:4 {c |}{res}          1        1.06       82.98
{txt}     2002:2 {c |}{res}          1        1.06       84.04
{txt}     2003:2 {c |}{res}          1        1.06       85.11
{txt}     2003:3 {c |}{res}          1        1.06       86.17
{txt}     2003:4 {c |}{res}          1        1.06       87.23
{txt}     2004:3 {c |}{res}          1        1.06       88.30
{txt}     2005:1 {c |}{res}          1        1.06       89.36
{txt}     2005:2 {c |}{res}          1        1.06       90.43
{txt}     2005:3 {c |}{res}          1        1.06       91.49
{txt}     2005:4 {c |}{res}          1        1.06       92.55
{txt}     2006:1 {c |}{res}          1        1.06       93.62
{txt}     2006:2 {c |}{res}          1        1.06       94.68
{txt}     2006:3 {c |}{res}          1        1.06       95.74
{txt}     2006:4 {c |}{res}          1        1.06       96.81
{txt}     2007:2 {c |}{res}          1        1.06       97.87
{txt}     2007:3 {c |}{res}          1        1.06       98.94
{txt}     2007:4 {c |}{res}          1        1.06      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         94      100.00
{txt}
{com}. 
. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima mUSCasualty, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-252.9037{col 48}    3{col 57} 511.8074{col 69} 521.0329
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-251.6962{col 48}    4{col 57} 511.3924{col 69} 523.6931
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-250.7645{col 48}    5{col 57}  511.529{col 69} 526.9048
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-250.7505{col 48}    6{col 57}  513.501{col 69}  531.952
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-250.4002{col 48}    7{col 57} 514.8004{col 69} 536.3266
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-249.9054{col 48}    8{col 57} 515.8109{col 69} 540.4123
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-249.4013{col 48}    9{col 57} 516.8027{col 69} 544.4792
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-249.3546{col 48}   10{col 57} 518.7092{col 69}  549.461
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(2) according to AIC and AR(1) according to BIC
. * Parsimonity --> estimating AR(1)
. 
. regress mUSCasualty L.mUSCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     159
                                                       {help j_robustsingular:F(  5,   152) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.1502
                                                       {txt}Root MSE      = {res} 1.1125

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
 mUSCasualty {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
 mUSCasualty {c |}
         L1. {c |}  {res}-.0346144   .0972144    -0.36   0.722    -.2266803    .1574515
        {txt}FUND {c |}  {res} .8832221   .2740942     3.22   0.002     .3416959    1.424748
        {txt}POST {c |}  {res}-.7925032   .2847613    -2.78   0.006    -1.355104    -.229902
        {txt}SEPT {c |}  {res} .0936807   .2307785     0.41   0.685     -.362267    .5496284
          {txt}Dp {c |}  {res} 3.389012   .2125163    15.95   0.000     2.969145    3.808879
        {txt}IRAQ {c |}  {res}-.1511593   .3154534    -0.48   0.632    -.7743986    .4720801
       {txt}_cons {c |}  {res} .4265882   .1056135     4.04   0.000     .2179284    .6352481
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double mUSCasualty_pred
{txt}(option xb assumed; fitted values)
(1 missing value generated)

{com}. line mUSCasualty mUSCasualty_pred Quarter
{res}{txt}
{com}. drop mUSCasualty_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   152) ={res}  414.33
{txt}{col 13}Prob > F ={res}    0.0000
{txt}
{com}. 
. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(1 missing value generated)

{com}. wntestq resid, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    2.4398
{txt} Prob > chi2({res}4{txt})            = {res}    0.6554
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if mUSCasualty==0
{res}   94
{txt}
{com}. * 94 zero observations - grid search to find c ==> c=0.99
. gen ystar=mUSCasualty
{txt}
{com}. replace ystar=0.99 if mUSCasualty==0
{txt}(94 real changes made)

{com}. gen lmUSCasualty=ln(ystar)
{txt}
{com}. nbreg mUSCasualty L.lmUSCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-190.76922{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-184.38054{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-184.13937{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-184.13897{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-184.13897{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res}-187.23982{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-187.09283{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-187.09124{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-187.09124{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-178.38944{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res} -176.7672{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-176.71204{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}  -176.712{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}  -176.712{txt}  

Negative binomial regression                      Number of obs   =  {res}      159
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}5{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-176.712                   {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text} mUSCasualty{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}lmUSCasualty{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2}-.2357569{col 26}{space 2}  .312061{col 37}{space 1}   -0.76{col 46}{space 3}0.450{col 55}{space 3}-.8473852{col 67}{space 3} .3758715
{col 1}{text}        FUND{col 14}{c |}{result}{space 2} 1.183998{col 26}{space 2} .3017085{col 37}{space 1}    3.92{col 46}{space 3}0.000{col 55}{space 3} .5926599{col 67}{space 3} 1.775336
{col 1}{text}        POST{col 14}{c |}{result}{space 2}-.9848882{col 26}{space 2} .3143606{col 37}{space 1}   -3.13{col 46}{space 3}0.002{col 55}{space 3}-1.601024{col 67}{space 3}-.3687527
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .1469642{col 26}{space 2} .3982929{col 37}{space 1}    0.37{col 46}{space 3}0.712{col 55}{space 3}-.6336756{col 67}{space 3}  .927604
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} 1.913244{col 26}{space 2} .3153291{col 37}{space 1}    6.07{col 46}{space 3}0.000{col 55}{space 3} 1.295211{col 67}{space 3} 2.531278
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2} -.263948{col 26}{space 2} .6194261{col 37}{space 1}   -0.43{col 46}{space 3}0.670{col 55}{space 3}-1.478001{col 67}{space 3} .9501048
{col 1}{text}       _cons{col 14}{c |}{result}{space 2}-.8753931{col 26}{space 2} .2301559{col 37}{space 1}   -3.80{col 46}{space 3}0.000{col 55}{space 3} -1.32649{col 67}{space 3}-.4242959
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-.3508585{col 27}{space 1}  .363452{col 55}{space 3}-1.063211{col 67}{space 3} .3614944
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .7040834{col 27}{space 1} .2559005{col 55}{space 3}  .345345{col 67}{space 3} 1.435473
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[mUSCasualty]L.lmUSCasualty = 0
{txt} ( 2)  {res}[mUSCasualty]FUND = 0
{txt} ( 3)  {res}[mUSCasualty]POST = 0
{txt} ( 4)  {res}[mUSCasualty]SEPT = 0
{txt} ( 5)  {res}[mUSCasualty]Dp = 0
{txt} ( 6)  {res}[mUSCasualty]IRAQ = 0

           {txt}chi2(  6) ={res}  264.15
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double mUSCasualty_pred
{txt}(option n assumed; predicted number of events)
(1 missing value generated)

{com}. line mUSCasualty mUSCasualty_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[mUSCasualty]SEPT = 0
{txt} ( 2)  {res}[mUSCasualty]Dp = 0

{txt}{col 12}chi2(  2) ={res}  106.42
{txt}{col 10}Prob > chi2 =  {res}  0.0000
{txt}
{com}. * Ljung-Box statistic Q(4) - testing H0: white noise(in residuals)--> the first 4 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (mUSCasualty-mUSCasualty_pred)/sqrt( mUSCasualty_pred*(1+mUSCasualty_pred*s2) )
{txt}(1 missing value generated)

{com}. wntestq nbresidual, lags(4)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    3.1856
{txt} Prob > chi2({res}4{txt})            = {res}    0.5273
{txt}
{com}. drop nbresidual mUSCasualty_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg mUSCasualty L.lmUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  159{col 25}-187.0912{col 37} -176.712{col 48}    7{col 57}  367.424{col 69} 388.9063
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress mUSCasualty L.mUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  159{col 25}-251.9206{col 37}-238.9843{col 48}    6{col 57} 489.9686{col 69} 508.3821
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg mUSCasualty L.mUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  159{col 25}-187.0912{col 37}  -176.97{col 48}    7{col 57} 367.9401{col 69} 389.4224
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson mUSCasualty L.mUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  159{col 25}-202.5906{col 37}-184.4526{col 48}    6{col 57} 380.9051{col 69} 399.3185
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar lmUSCasualty
{txt}
{com}. 
. *ITERATE
. sum iUSCasualty

{txt}    Variable {c |}       Obs        Mean    Std. Dev.       Min        Max
{hline 13}{c +}{hline 56}
 iUSCasualty {c |}{res}       160      1.2375    1.472975          0          8
{txt}
{com}. tab Quarter if iUSCasualty==0

    {txt}Quarter {c |}      Freq.     Percent        Cum.
{hline 12}{c +}{hline 35}
     1968:4 {c |}{res}          1        1.52        1.52
{txt}     1969:1 {c |}{res}          1        1.52        3.03
{txt}     1969:2 {c |}{res}          1        1.52        4.55
{txt}     1969:3 {c |}{res}          1        1.52        6.06
{txt}     1969:4 {c |}{res}          1        1.52        7.58
{txt}     1970:2 {c |}{res}          1        1.52        9.09
{txt}     1970:4 {c |}{res}          1        1.52       10.61
{txt}     1971:1 {c |}{res}          1        1.52       12.12
{txt}     1971:3 {c |}{res}          1        1.52       13.64
{txt}     1972:1 {c |}{res}          1        1.52       15.15
{txt}     1973:1 {c |}{res}          1        1.52       16.67
{txt}     1973:2 {c |}{res}          1        1.52       18.18
{txt}     1973:4 {c |}{res}          1        1.52       19.70
{txt}     1974:1 {c |}{res}          1        1.52       21.21
{txt}     1977:4 {c |}{res}          1        1.52       22.73
{txt}     1978:1 {c |}{res}          1        1.52       24.24
{txt}     1978:4 {c |}{res}          1        1.52       25.76
{txt}     1979:3 {c |}{res}          1        1.52       27.27
{txt}     1980:1 {c |}{res}          1        1.52       28.79
{txt}     1980:2 {c |}{res}          1        1.52       30.30
{txt}     1983:2 {c |}{res}          1        1.52       31.82
{txt}     1984:2 {c |}{res}          1        1.52       33.33
{txt}     1988:1 {c |}{res}          1        1.52       34.85
{txt}     1988:3 {c |}{res}          1        1.52       36.36
{txt}     1989:1 {c |}{res}          1        1.52       37.88
{txt}     1989:2 {c |}{res}          1        1.52       39.39
{txt}     1989:4 {c |}{res}          1        1.52       40.91
{txt}     1990:1 {c |}{res}          1        1.52       42.42
{txt}     1990:3 {c |}{res}          1        1.52       43.94
{txt}     1991:2 {c |}{res}          1        1.52       45.45
{txt}     1991:3 {c |}{res}          1        1.52       46.97
{txt}     1991:4 {c |}{res}          1        1.52       48.48
{txt}     1992:3 {c |}{res}          1        1.52       50.00
{txt}     1992:4 {c |}{res}          1        1.52       51.52
{txt}     1993:2 {c |}{res}          1        1.52       53.03
{txt}     1993:3 {c |}{res}          1        1.52       54.55
{txt}     1993:4 {c |}{res}          1        1.52       56.06
{txt}     1994:2 {c |}{res}          1        1.52       57.58
{txt}     1994:3 {c |}{res}          1        1.52       59.09
{txt}     1995:2 {c |}{res}          1        1.52       60.61
{txt}     1995:4 {c |}{res}          1        1.52       62.12
{txt}     1997:1 {c |}{res}          1        1.52       63.64
{txt}     1997:2 {c |}{res}          1        1.52       65.15
{txt}     1998:1 {c |}{res}          1        1.52       66.67
{txt}     1998:2 {c |}{res}          1        1.52       68.18
{txt}     1998:3 {c |}{res}          1        1.52       69.70
{txt}     1998:4 {c |}{res}          1        1.52       71.21
{txt}     1999:1 {c |}{res}          1        1.52       72.73
{txt}     1999:2 {c |}{res}          1        1.52       74.24
{txt}     1999:3 {c |}{res}          1        1.52       75.76
{txt}     1999:4 {c |}{res}          1        1.52       77.27
{txt}     2000:1 {c |}{res}          1        1.52       78.79
{txt}     2000:3 {c |}{res}          1        1.52       80.30
{txt}     2001:1 {c |}{res}          1        1.52       81.82
{txt}     2001:2 {c |}{res}          1        1.52       83.33
{txt}     2002:2 {c |}{res}          1        1.52       84.85
{txt}     2003:4 {c |}{res}          1        1.52       86.36
{txt}     2004:1 {c |}{res}          1        1.52       87.88
{txt}     2005:2 {c |}{res}          1        1.52       89.39
{txt}     2005:4 {c |}{res}          1        1.52       90.91
{txt}     2006:3 {c |}{res}          1        1.52       92.42
{txt}     2006:4 {c |}{res}          1        1.52       93.94
{txt}     2007:1 {c |}{res}          1        1.52       95.45
{txt}     2007:2 {c |}{res}          1        1.52       96.97
{txt}     2007:3 {c |}{res}          1        1.52       98.48
{txt}     2007:4 {c |}{res}          1        1.52      100.00
{txt}{hline 12}{c +}{hline 35}
      Total {c |}{res}         66      100.00
{txt}
{com}. 
. forvalues i=1/8 {c -(}
{txt}  2{com}. qui arima iUSCasualty, ar(1/`i')
{txt}  3{com}. estat ic
{txt}  4{com}. {c )-}

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37} -287.729{col 48}    3{col 57}  581.458{col 69} 590.6835
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-284.5809{col 48}    4{col 57} 577.1618{col 69} 589.4624
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-281.0381{col 48}    5{col 57} 572.0761{col 69}  587.452
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-280.8747{col 48}    6{col 57} 573.7495{col 69} 592.2005
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-275.8102{col 48}    7{col 57} 565.6204{col 69} 587.1466
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-275.1466{col 48}    8{col 57} 566.2931{col 69} 590.8945
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-274.8924{col 48}    9{col 57} 567.7847{col 69} 595.4613
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  160{col 25}        .{col 37}-274.8621{col 48}   10{col 57} 569.7241{col 69} 600.4759
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. 
. * Choosing model AR(5) according to AIC and AR(5) according to BIC
. * Estimating AR(5)
. 
. regress iUSCasualty L(1/5).iUSCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Linear regression                                      Number of obs ={res}     155
                                                       {help j_robustsingular:F(  9,   144) =}       .
                                                       {txt}Prob > F      = {res}      .
                                                       {txt}R-squared     = {res} 0.2148
                                                       {txt}Root MSE      = {res} 1.3649

{txt}{hline 13}{c TT}{hline 64}
             {c |}               Robust
 iUSCasualty {c |}      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
{hline 13}{char +}{hline 64}
 iUSCasualty {c |}
         L1. {c |}  {res}-.0008074   .0749138    -0.01   0.991    -.1488802    .1472653
         {txt}L2. {c |}  {res} .1118027   .0780055     1.43   0.154    -.0423811    .2659865
         {txt}L3. {c |}  {res} .1454015   .0896275     1.62   0.107     -.031754    .3225569
         {txt}L4. {c |}  {res} .0337331   .0766257     0.44   0.660    -.1177233    .1851896
         {txt}L5. {c |}  {res} .2315423   .1117593     2.07   0.040     .0106417    .4524429
        {txt}FUND {c |}  {res} .0347609   .3407761     0.10   0.919    -.6388086    .7083304
        {txt}POST {c |}  {res}-.4488226   .2930251    -1.53   0.128    -1.028009    .1303636
        {txt}SEPT {c |}  {res} .5013598   .4097912     1.22   0.223    -.3086232    1.311343
          {txt}Dp {c |}  {res} 3.828356   .4041342     9.47   0.000     3.029554    4.627158
        {txt}IRAQ {c |}  {res}-.5193314   .4670534    -1.11   0.268    -1.442498    .4038347
       {txt}_cons {c |}  {res} .7074022   .2667322     2.65   0.009     .1801859    1.234619
{txt}{hline 13}{c BT}{hline 64}

{com}. 
. predict double iUSCasualty_pred
{txt}(option xb assumed; fitted values)
(5 missing values generated)

{com}. line iUSCasualty iUSCasualty_pred Quarter
{res}{txt}
{com}. drop iUSCasualty_pred
{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}SEPT = 0
{txt} ( 2)  {res}Dp = 0

{txt}       F(  2,   144) ={res}  295.38
{txt}{col 13}Prob > F ={res}    0.0000
{txt}
{com}. 
. * Ljung-Box statistic Q(6) - testing H0: white noise(in residuals)--> the first 6 autocorrelations are jointly insignificant
. predict double resid, residual
{txt}(5 missing values generated)

{com}. wntestq resid, lags(6)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    0.7325
{txt} Prob > chi2({res}6{txt})            = {res}    0.9938
{txt}
{com}. drop resid
{txt}
{com}. 
. *Negative binomial
. count if iUSCasualty==0
{res}   66
{txt}
{com}. * 66 zero observations - grid search to find c ==> c=0.01
. gen ystar=iUSCasualty
{txt}
{com}. replace ystar=0.01 if iUSCasualty==0
{txt}(66 real changes made)

{com}. gen liUSCasualty=ln(ystar)
{txt}
{com}. nbreg iUSCasualty L(1/5).liUSCasualty FUND POST SEPT Dp IRAQ, robust

{txt}Fitting Poisson model:

Iteration 0:{col 16}log pseudolikelihood = {res}-227.43593{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-226.12392{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-226.12326{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-226.12326{txt}  

Fitting constant-only model:

Iteration 0:{col 16}log pseudolikelihood = {res} -240.3108{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res}-239.29916{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-239.29717{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-239.29717{txt}  

Fitting full model:

Iteration 0:{col 16}log pseudolikelihood = {res}-225.35894{txt}  
Iteration 1:{col 16}log pseudolikelihood = {res} -222.2762{txt}  
Iteration 2:{col 16}log pseudolikelihood = {res}-222.05157{txt}  
Iteration 3:{col 16}log pseudolikelihood = {res}-222.05027{txt}  
Iteration 4:{col 16}log pseudolikelihood = {res}-222.05027{txt}  

Negative binomial regression                      Number of obs   =  {res}      155
{txt}Dispersion           = {res}mean                       {txt}Wald chi2({res}9{txt})    =  {res}        .
{txt}Log pseudolikelihood = {res}-222.05027                 {txt}Prob > chi2     =  {res}        .

{col 1}{text}{hline 13}{c TT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 14}{text}{c |}{col 26}    Robust
{col 1}{text} iUSCasualty{col 14}{c |}      Coef.{col 26}   Std. Err.{col 37}      z{col 46}   P>|z|{col 55}    [95% Conf. Interval]
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}liUSCasualty{col 14}{c |}
{col 1}{text}         L1.{col 14}{c |}{result}{space 2}-.0020607{col 26}{space 2} .0356523{col 37}{space 1}   -0.06{col 46}{space 3}0.954{col 55}{space 3}-.0719379{col 67}{space 3} .0678166
{col 1}{text}         L2.{col 14}{c |}{result}{space 2} .0502863{col 26}{space 2} .0352617{col 37}{space 1}    1.43{col 46}{space 3}0.154{col 55}{space 3}-.0188254{col 67}{space 3}  .119398
{col 1}{text}         L3.{col 14}{c |}{result}{space 2} .1098221{col 26}{space 2} .0364446{col 37}{space 1}    3.01{col 46}{space 3}0.003{col 55}{space 3} .0383919{col 67}{space 3} .1812522
{col 1}{text}         L4.{col 14}{c |}{result}{space 2} .0473542{col 26}{space 2} .0353244{col 37}{space 1}    1.34{col 46}{space 3}0.180{col 55}{space 3}-.0218804{col 67}{space 3} .1165888
{col 1}{text}         L5.{col 14}{c |}{result}{space 2} .0566554{col 26}{space 2} .0390738{col 37}{space 1}    1.45{col 46}{space 3}0.147{col 55}{space 3}-.0199277{col 67}{space 3} .1332386
{col 1}{text}        FUND{col 14}{c |}{result}{space 2}-.0330431{col 26}{space 2} .2114246{col 37}{space 1}   -0.16{col 46}{space 3}0.876{col 55}{space 3}-.4474276{col 67}{space 3} .3813415
{col 1}{text}        POST{col 14}{c |}{result}{space 2}-.4500611{col 26}{space 2} .2923276{col 37}{space 1}   -1.54{col 46}{space 3}0.124{col 55}{space 3}-1.023013{col 67}{space 3} .1228903
{col 1}{text}        SEPT{col 14}{c |}{result}{space 2} .6633508{col 26}{space 2} .3591794{col 37}{space 1}    1.85{col 46}{space 3}0.065{col 55}{space 3}-.0406278{col 67}{space 3} 1.367329
{col 1}{text}          Dp{col 14}{c |}{result}{space 2} 1.234084{col 26}{space 2} .3375578{col 37}{space 1}    3.66{col 46}{space 3}0.000{col 55}{space 3} .5724828{col 67}{space 3} 1.895685
{col 1}{text}        IRAQ{col 14}{c |}{result}{space 2}-.5860612{col 26}{space 2}  .394872{col 37}{space 1}   -1.48{col 46}{space 3}0.138{col 55}{space 3}-1.359996{col 67}{space 3} .1878736
{col 1}{text}       _cons{col 14}{c |}{result}{space 2} .6352687{col 26}{space 2} .1764771{col 37}{space 1}    3.60{col 46}{space 3}0.000{col 55}{space 3}   .28938{col 67}{space 3} .9811574
{col 1}{text}{hline 13}{c +}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}
{col 1}{text}    /lnalpha{col 14}{c |}{result}{space 2}-1.196108{col 27}{space 1} .4227165{col 55}{space 3}-2.024617{col 67}{space 3}-.3675989
{col 1}{text}{hline 13}{c +}{hline 12}{hline 12}{hline 8}{hline 8}{hline 12}{hline 12}
{col 1}{text}       alpha{col 14}{c |}{result}{space 2} .3023688{col 27}{space 1} .1278163{col 55}{space 3} .1320444{col 67}{space 3} .6923949
{col 1}{text}{hline 13}{c BT}{hline 11}{hline 11}{hline 9}{hline 9}{hline 12}{hline 12}

{com}. test

{txt} ( 1)  {res}[iUSCasualty]L.liUSCasualty = 0
{txt} ( 2)  {res}[iUSCasualty]L2.liUSCasualty = 0
{txt} ( 3)  {res}[iUSCasualty]L3.liUSCasualty = 0
{txt} ( 4)  {res}[iUSCasualty]L4.liUSCasualty = 0
{txt} ( 5)  {res}[iUSCasualty]L5.liUSCasualty = 0
{txt} ( 6)  {res}[iUSCasualty]FUND = 0
{txt} ( 7)  {res}[iUSCasualty]POST = 0
{txt} ( 8)  {res}[iUSCasualty]SEPT = 0
{txt} ( 9)  {res}[iUSCasualty]Dp = 0
{txt} (10)  {res}[iUSCasualty]IRAQ = 0

           {txt}chi2( 10) ={res}  294.46
         {txt}Prob > chi2 ={res}    0.0000

{txt}
{com}. predict double iUSCasualty_pred
{txt}(option n assumed; predicted number of events)
(5 missing values generated)

{com}. line iUSCasualty iUSCasualty_pred Quarter
{res}{txt}
{com}. 
. *Testing null that 9/11 did have no impact on terrorism patterns (for F column)
. test SEPT Dp

{txt} ( 1)  {res}[iUSCasualty]SEPT = 0
{txt} ( 2)  {res}[iUSCasualty]Dp = 0

{txt}{col 12}chi2(  2) ={res}   41.52
{txt}{col 10}Prob > chi2 =  {res}  0.0000
{txt}
{com}. * Ljung-Box statistic Q(6) - testing H0: white noise(in residuals)--> the first 6 autocorrelations are jointly insignificant
. *** Predicting Pearson residuals
. scalar s2 = exp(_b[/lnalpha]) 
{txt}
{com}. gen nbresidual = (iUSCasualty-iUSCasualty_pred)/sqrt( iUSCasualty_pred*(1+iUSCasualty_pred*s2) )
{txt}(5 missing values generated)

{com}. wntestq nbresidual, lags(6)

{txt}Portmanteau test for white noise
{hline 39}
 Portmanteau (Q) statistic = {res}    3.8548
{txt} Prob > chi2({res}6{txt})            = {res}    0.6963
{txt}
{com}. drop nbresidual iUSCasualty_pred
{txt}
{com}. 
. * Which one is better fit? Based on AIC and BIC
. qui nbreg iUSCasualty L(1/5).liUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  155{col 25}-239.2972{col 37}-222.0503{col 48}   11{col 57} 466.1005{col 69} 499.5782
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui regress iUSCasualty L(1/5).iUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  155{col 25}-281.1947{col 37}-262.4493{col 48}   10{col 57} 544.8987{col 69} 575.3329
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui nbreg iUSCasualty L(1/5).iUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  155{col 25}-239.2972{col 37}-222.6953{col 48}   11{col 57} 467.3907{col 69} 500.8683
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. qui poisson iUSCasualty L(1/5).iUSCasualty FUND POST SEPT Dp IRAQ, robust
{txt}
{com}. estat ic

{txt}{hline 13}{c TT}{hline 63}
       Model {c |}    Obs    ll(null)   ll(model)     df          AIC         BIC
{hline 13}{c +}{hline 63}
{ralign 12:.}{col 14}{c |}{res}{col 17}  155{col 25}-253.4113{col 37}-227.2623{col 48}   10{col 57} 474.5247{col 69} 504.9589
{txt}{hline 13}{c BT}{hline 63}
{p 15 22 2}
Note:  N=Obs used in calculating BIC; see {helpb bic_note:[R] BIC note}
{p_end}

{com}. drop ystar liUSCasualty
{txt}
{com}. 
{txt}end of do-file

{com}. log close
       {txt}log:  {res}HICs.smcl
  {txt}log type:  {res}smcl
 {txt}closed on:  {res} 9 Jan 2011, 16:24:22
{txt}{.-}
{smcl}
{txt}{sf}{ul off}